Skip to content

feat: add getTotalAmountDue and multicall batching for view commands - #13

Merged
solidoracle merged 2 commits into
mainfrom
feat/invoice-total-due
Apr 9, 2026
Merged

feat: add getTotalAmountDue and multicall batching for view commands#13
solidoracle merged 2 commits into
mainfrom
feat/invoice-total-due

Conversation

@bengobeil

@bengobeil bengobeil commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add getTotalAmountDue ABI entry and invoice total-due view command
  • Change all view commands from --claim-id (singular) to --claim-ids (comma-separated) for batch lookups
  • Implement batch reader methods using viem's built-in multicall() — all claim IDs are resolved in a single RPC call via Multicall3
  • Add formatViewResults for multi-result output (JSON array / human-readable blocks)

Commands updated

  • invoice get, invoice deposit-needed, invoice total-due
  • frendlend get-loan, frendlend total-due

Test plan

  • npx tsc --noEmit passes
  • 178 unit tests pass
  • E2e tests pass with updated --claim-ids flag
  • Manual: bulla invoice total-due --claim-ids 1,2,3 --rpc-url ... --chain ... returns batched results

🤖 Generated with Claude Code

- Add getTotalAmountDue ABI + view command for invoices
- Change all view commands from --claim-id to --claim-ids (comma-separated)
- Implement batch reader methods using viem multicall for single-RPC lookups
- Add formatViewResults for multi-result output
Comment thread src/infrastructure/reading/viem-frendlend-reader.ts Outdated
Comment thread test/e2e/view-functions.e2e.test.ts
getTotalAmountDue is self-sufficient — no need to fetch the full loan
just to validate existence. Also adds a total-due e2e test after
accepting a loan offer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@solidoracle
solidoracle merged commit 5f63a34 into main Apr 9, 2026
1 check passed
@bengobeil

Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 0.0.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants